﻿using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
using System.Reflection;

namespace Pacman
{
  public partial class Program
  {
    private PacmanGame _pacmanGame = null;
    private AudioManager _audio = null;

    void ProgramStarted()
    {
      var surface = (Bitmap)(display.SimpleGraphics.GetType().GetField("_display", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(display.SimpleGraphics));
      
      _pacmanGame = new PacmanGame(surface);
      _pacmanGame.InputManager.AddInputProvider(new GhiJoystickInputProvider(joystick));
      _pacmanGame.Initialize();

      _audio = new AudioManager(music);
    }
  }
}
